import ddt
from testconfig import config

from framework.basetest import BaseTest


@ddt.ddt()
class AndrAppDeployTest(BaseTest):
    _multiprocess_can_split_ = True

    def setUp(self):
        super().setUp(config=config)

    def tearDown(self):
        super().tearDown()

    @ddt.data('SamSung1', 'SamSung2')
    def test_deploy(self, device_name):
        udid = self.hs_api.get_device_udid_by_name(device_name)
        app_id = self.hs_api.get_appId_by_BuildCommit(self.androidBuildCommit)
        self.hs_api.uninstall_app(udid, self.appPackage, True)
        response = self.hs_api.install_pre_upload_app(udid, app_id)
        self.assertEqual(200, response.status_code)
        self.assertEqual(0, response.json()['returncode'])
